﻿@Html.DevExpress().GridView(
            settings =>
            {
                settings.Name = "gvEditing";
                settings.KeyFieldName = "ZSXH";
                settings.CallbackRouteValues = new { Controller = "GSImportDate", Action = "GompareImportDateListPartial" };
                settings.Width =System.Web.UI.WebControls.Unit.Pixel(1800);

                //settings.Columns.Add(ss => {
                //    ss.Caption = "纳税识别号";
                //    ss.FieldName = "NSRSBH";
                //    ss.SetDataItemTemplateContent(c =>
                //    {
                //        Html.DevExpress().Label(labst => {
                //            labst.Name = "lab" + c.VisibleIndex;
                //            if (DataBinder.Eval(c.DataItem, "NSRDZDAH") != null && DataBinder.Eval(c.DataItem, "NSRDZDAH").ToString() != "")
                //            {
                //                labst.ControlStyle.ForeColor = System.Drawing.Color.Black; 
                //            }
                //            else
                //            {
                //                labst.ControlStyle.ForeColor = System.Drawing.Color.Red; 
                //            }
                //        }).GetHtml();
                //    });
                //});

                //settings.Columns.Add(ss =>
                //{
                //    ss.Caption = "纳税人名称";
                //    ss.FieldName = "NSRMC";
                //    ss.SetDataItemTemplateContent(c =>
                //    {
                //        Html.DevExpress().Label(labst =>
                //        {
                //            labst.Name = "lab2" + c.VisibleIndex;
                //            if (DataBinder.Eval(c.DataItem, "NSRDZDAH") != null && DataBinder.Eval(c.DataItem, "NSRDZDAH").ToString() != "")
                //            {
                //                labst.ControlStyle.ForeColor = System.Drawing.Color.Black;
                //            }
                //            else
                //            {
                //                labst.ControlStyle.ForeColor = System.Drawing.Color.Red;
                //            }
                //        }).GetHtml();
                //    });
                //});

                //settings.Columns.Add("NSRSBH", "纳税识别号");
                settings.Columns.Add(column =>
                {
                    column.Caption = "操作";

                    column.SetDataItemTemplateContent(c =>
                    {
                        Html.DevExpress().HyperLink(s => { s.Name = "linkEdit" + c.VisibleIndex; s.Properties.Text = "修改"; s.ToolTip = "修改"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_Edit.png"); s.Properties.ClientSideEvents.Click = "function(){codeEdit('" + DataBinder.Eval(c.DataItem, "NSRSBH") + "','" + DataBinder.Eval(c.DataItem, "NSRMC") + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();
                    });
                    column.Settings.AllowDragDrop = DefaultBoolean.False;
                    column.Settings.AllowSort = DefaultBoolean.False;
                    column.Width = 70;
                });
                settings.Columns.Add(column =>
                {
                    column.FieldName = "NSRSBH";
                    column.Caption = "纳税识别号";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "NSRDZDAH") != null && DataBinder.Eval(c.DataItem, "NSRDZDAH").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "NSRSBH") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "NSRSBH") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("NSRMC", "纳税人名称");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "NSRMC";
                    column.Caption = "纳税人名称";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "NSRDZDAH") != null && DataBinder.Eval(c.DataItem, "NSRDZDAH").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "NSRMC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "NSRMC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("ZSXM_MC", "征收项目");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "ZSXM_MC";
                    column.Caption = "征收项目";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "ZSXM_DM") != null && DataBinder.Eval(c.DataItem, "ZSXM_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "ZSXM_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "ZSXM_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("SKZL_MC", "税款种类");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "SKZL_MC";
                    column.Caption = "税款种类";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "SKZL_DM") != null && DataBinder.Eval(c.DataItem, "SKZL_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "SKZL_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "SKZL_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("SKSX_MC", "税款属性");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "SKSX_MC";
                    column.Caption = "税款属性";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "SKSX_DM") != null && DataBinder.Eval(c.DataItem, "SKSX_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "SKSX_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "SKSX_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("SKCSFS_MC", "税款产生方式");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "SKCSFS_MC";
                    column.Caption = "税款产生方式";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "SKCSFS_DM") != null && DataBinder.Eval(c.DataItem, "SKCSFS_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "SKCSFS_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "SKCSFS_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("QLQQSLX_MC", "欠税类型");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "QLQQSLX_MC";
                    column.Caption = "欠税类型";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "QLQQSLX_DM") != null && DataBinder.Eval(c.DataItem, "QLQQSLX_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "QLQQSLX_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "QLQQSLX_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("TZLX_MC", "调帐类型");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "TZLX_MC";
                    column.Caption = "调帐类型";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "TZLX_DM") != null && DataBinder.Eval(c.DataItem, "TZLX_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "TZLX_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "TZLX_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("YZPZZL_MC", "票证种类");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "YZPZZL_MC";
                    column.Caption = "票证种类";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "YZPZZL_DM") != null && DataBinder.Eval(c.DataItem, "YZPZZL_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "YZPZZL_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "YZPZZL_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("ZSPM_MC", "征收品目");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "ZSPM_MC";
                    column.Caption = "征收品目";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "ZSPM_DM") != null && DataBinder.Eval(c.DataItem, "ZSPM_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "ZSPM_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "ZSPM_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("JKPZZL_MC", "票证种类");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "JKPZZL_MC";
                    column.Caption = "票证种类";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "JKPZZL_DM") != null && DataBinder.Eval(c.DataItem, "JKPZZL_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "JKPZZL_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "JKPZZL_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("DJZCLX_MC", "登记注册类型");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "DJZCLX_MC";
                    column.Caption = "登记注册类型";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "DJZCLX_DM") != null && DataBinder.Eval(c.DataItem, "DJZCLX_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "DJZCLX_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "DJZCLX_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("HY_MC", "行业");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "HY_MC";
                    column.Caption = "行业";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "HY_DM") != null && DataBinder.Eval(c.DataItem, "HY_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "HY_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "HY_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("ZSFS_MC", "征收方式");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "ZSFS_MC";
                    column.Caption = "征收方式";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "ZSFS_DM") != null && DataBinder.Eval(c.DataItem, "ZSFS_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "ZSFS_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "ZSFS_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("YSKM_MC", "预算科目");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "YSKM_MC";
                    column.Caption = "预算科目";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "YSKM_DM") != null && DataBinder.Eval(c.DataItem, "YSKM_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "YSKM_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "YSKM_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("YSFPBL_MC", "预算分配比例");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "YSFPBL_MC";
                    column.Caption = "预算分配比例";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "YSFPBL_DM") != null && DataBinder.Eval(c.DataItem, "YSFPBL_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "YSFPBL_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "YSFPBL_MC") + "</font> ");
                        }
                    });
                });
                //settings.Columns.Add("SKGK_MC", "收款国库");
                settings.Columns.Add(column =>
                {
                    column.FieldName = "SKGK_MC";
                    column.Caption = "收款国库";
                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "SKGK_DM") != null && DataBinder.Eval(c.DataItem, "SKGK_DM").ToString() != "")
                        {
                            ViewContext.Writer.Write("<font Color='black' > " + DataBinder.Eval(c.DataItem, "SKGK_MC") + "</font> ");
                        }
                        else
                        {

                            ViewContext.Writer.Write("<font Color='red' > " + DataBinder.Eval(c.DataItem, "SKGK_MC") + "</font> ");
                        }
                    });
                });
                
                
                settings.SettingsBehavior.AllowSort = false;
                settings.SettingsBehavior.AllowDragDrop = false;
                settings.SettingsBehavior.AllowSelectByRowClick = false;
                settings.SettingsLoadingPanel.Text = "数据读取中...";
                settings.SettingsBehavior.AllowClientEventsOnLoad = false;
                settings.SettingsBehavior.AllowFocusedRow = true;


                settings.ClientSideEvents.BeginCallback = "function(s,e){OnBeginCallback(s,e)}";
                settings.Settings.ShowFooter = false;
                settings.CommandColumn.Visible = false;
                settings.CommandColumn.ShowSelectCheckbox = false;
                settings.CommandColumn.Width = System.Web.UI.WebControls.Unit.Pixel(5);

                settings.SettingsPager.Position = System.Web.UI.WebControls.PagerPosition.Bottom;
                settings.SettingsPager.FirstPageButton.Visible = true;
                settings.SettingsPager.LastPageButton.Visible = true;
                settings.SettingsPager.PageSize = EnterpriseFund.Common.GlobalConstant.CONSTRING_PAGESIZE;
                settings.SettingsPager.AlwaysShowPager = true;
                settings.Settings.ShowFooter = true;
                
                settings.PageIndexChanged = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    grid.Selection.UnselectAll();
                };
                settings.DataBinding = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    for (int i = 0; i < grid.AllColumns.Count; i++)
                    {
                        if (grid.AllColumns[i].CellStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                        if (grid.AllColumns[i].HeaderStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                    }
                };
                
            }).Bind(Model).GetHtml()